<?php
class IndexController extends Zend_Controller_Action
{
    /**
     * @var Managers
     */
    protected $_manager;
    protected $_managerUser;
    protected $_managerPhones;
    protected $_managerPhotos;
    
    public function init()
    {

       $this->_manager = new Managers\Housing();
       $this->_managerUser = new Managers\UserInfo();
       $this->_managerPhones = new Managers\Phones();
       $this->_managerPhotos = new Managers\Photos();
       
       $this->_managerAreas = new Managers\Areas();

       $this->view->cutstr = new Helper_CutStr;
       $this->view->phonecode = new Helper_PhoneCode;
       $this->view->areas = new Helper_Areas;
       $this->view->metro = new Helper_Metro;
       $this->view->date = new Helper_Date;

       $this->view->areas_list = $this->_managerAreas->getAll();
       
    }

    public function indexAction()
    {
       $this->view->index = 1;
       $this->view->items = $this->_manager->getAll();
       $this->view->items_new = $this->_manager->getNew();
       
    }

    public function showhousingAction(){
       
       $this->view->item = $this->_manager->getOne($this->_getParam('id', 0));

       $this->view->phones = $this->_managerPhones->getOne($this->view->item->getUser());
       
       $this->view->userifno = $this->_managerUser->getOne($this->view->item->getUser());

       $this->view->title = _("район ".$this->view->areas->Make($this->view->item->getAreas())." (станція метро ".$this->view->metro->Make($this->view->item->getAreas(), $this->view->item->getMetro()).") , вулиця ".$this->view->item->getStreet().". Ціна: ".$this->view->item->getPrice()." $");

       $this->view->photos = $this->_managerPhotos->getAll($this->_getParam('id', 0));

    }
    
    public function aboutAction()
    {

    }

}

